package com.george.auth.controller;

import com.george.auth.service.UserNamePwdServiceImpl;
import com.george.common.entity.dto.user.LoginUserDTO;
import com.george.common.entity.vo.auth.LoginUserVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * @title: LoginController.java
 * @description:
 * @author: George
 * @date: 2023/6/13 17:53
 */
@Api(tags = "登录认证模块")
@RequestMapping("/auth")
@RestController
public class LoginController {

    @Resource
    private UserNamePwdServiceImpl userNamePwdService;

    @ApiOperation(value = "登录")
    @PostMapping(value = "/login")
    public LoginUserDTO login(@Valid @RequestBody LoginUserVO loginUserVO) {
        return userNamePwdService.loginByUserNameAndPwd(loginUserVO.getUsername(), loginUserVO.getPassword());
    }

    @ApiOperation(value = "测试")
    @GetMapping(value = "/test")
    public String test() {
        return "成功";
    }
}
